<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>层级选择器</title>
</head>
<body>
<div>
        <span>西天如来
            <span>南海观音</span>
            <span>东海龙王</span>
        </span>
    <span> 齐天大圣 </span>
</div>

<div></div>
<p>八戒</p>
<p>悟净</p>
</body>
<script  src="js/jquery-3.3.1.min.js"></script>
<script>
    //后代选择器
   let span1=$("div span");
   alert("后代选择器:"+span1.length);
   //子选择器
    let zi =$("span > span");
    alert("子选择器:"+zi.length);
    //兄弟选择器
    let dd=$("span + p")
    alert("兄弟选择器"+dd.length)
    //兄弟选择器
    let dd1=$("div~p")
    alert("兄弟选择器1"+dd1.length)

</script>
</html>